pushl %edx
pushl %ecx
pushl %ebx
-7: SET_XEN_SEGMENTS
+7: SET_XEN_SEGMENTS(a)
jmp failsafe_callback
.previous
.section __ex_table,"a"
ALIGN
ENTRY(hypercall)
pushl %eax # save orig_eax
- SAVE_ALL
+ SAVE_ALL(b)
sti
GET_CURRENT(%ebx)
andl $(NR_hypercalls-1),%eax
.section .fixup,"ax"
crash_domain_fixup1:
subl $4,%esp
- SAVE_ALL
+ SAVE_ALL(a)
sti
jmp domain_crash
crash_domain_fixup2:
movl %es,XREGS_es(%esp)
movl %fs,XREGS_fs(%esp)
movl %gs,XREGS_gs(%esp)
-1: SET_XEN_SEGMENTS
+1: SET_XEN_SEGMENTS(b)
movl XREGS_orig_eax(%esp),%esi # get the error code
movl XREGS_eax(%esp),%edi # get the function address
movl %eax,XREGS_eax(%esp)
# Save state but do not trash the segment registers!
# We may otherwise be unable to reload them or copy them to ring 1.
pushl %eax
- SAVE_ALL_NOSEGREGS
+ SAVE_ALL_NOSEGREGS(a)
# Check for hardware problems.
inb $0x61,%al
"\n"__ALIGN_STR"\n" \
SYMBOL_NAME_STR(x) ":\n\t" \
"push"__OS" $"#v"\n\t" \
- SAVE_ALL \
+ SAVE_ALL(a) \
SYMBOL_NAME_STR(call_##x)":\n\t" \
"call "SYMBOL_NAME_STR(smp_##x)"\n\t" \
"jmp ret_from_intr\n");
"\n"__ALIGN_STR"\n" \
SYMBOL_NAME_STR(x) ":\n\t" \
"push"__OS" $"#v"\n\t" \
- SAVE_ALL \
+ SAVE_ALL(a) \
"mov %"__OP"sp,%"__OP"ax\n\t" \
"push %"__OP"ax\n\t" \
SYMBOL_NAME_STR(call_##x)":\n\t" \
__asm__( \
"\n" __ALIGN_STR"\n" \
"common_interrupt:\n\t" \
- SAVE_ALL \
+ SAVE_ALL(a) \
SYMBOL_NAME_STR(call_do_IRQ)":\n\t" \
"call " SYMBOL_NAME_STR(do_IRQ) "\n\t" \
"jmp ret_from_intr\n");
/* AUTO-GENERATE the following two cases (quoted vs. unquoted). */
#ifndef __ASSEMBLY__
-#define __SAVE_ALL_PRE \
+#define __SAVE_ALL_PRE(_reg) \
"cld;" \
"pushl %eax;" \
"pushl %ebp;" \
"pushl %edx;" \
"pushl %ecx;" \
"pushl %ebx;" \
- "movb "STR(XREGS_cs)"(%esp),%al;" \
- "testb $3,%al;" \
+ "movb "STR(XREGS_cs)"(%esp),%"STR(_reg)"l;" \
+ "testb $3,%"STR(_reg)"l;" \
"je 1f;" \
"movl %ds,"STR(XREGS_ds)"(%esp);" \
"movl %es,"STR(XREGS_es)"(%esp);" \
"movl %fs,"STR(XREGS_fs)"(%esp);" \
"movl %gs,"STR(XREGS_gs)"(%esp);"
-#define SAVE_ALL_NOSEGREGS \
- __SAVE_ALL_PRE \
+#define SAVE_ALL_NOSEGREGS(_reg) \
+ __SAVE_ALL_PRE(_reg) \
"1:"
-#define SET_XEN_SEGMENTS \
- "movl $("STR(__HYPERVISOR_DS)"),%edx;" \
- "movl %edx,%ds;" \
- "movl %edx,%es;"
+#define SET_XEN_SEGMENTS(_reg) \
+ "movl $("STR(__HYPERVISOR_DS)"),%e"STR(_reg)"x;" \
+ "movl %e"STR(_reg)"x,%ds;" \
+ "movl %e"STR(_reg)"x,%es;"
-#define SAVE_ALL \
- __SAVE_ALL_PRE \
- SET_XEN_SEGMENTS \
+#define SAVE_ALL(_reg) \
+ __SAVE_ALL_PRE(_reg) \
+ SET_XEN_SEGMENTS(_reg) \
"1:"
#else
-#define __SAVE_ALL_PRE \
+#define __SAVE_ALL_PRE(_reg) \
cld; \
pushl %eax; \
pushl %ebp; \
pushl %edx; \
pushl %ecx; \
pushl %ebx; \
- movb XREGS_cs(%esp),%dl; \
- testb $3,%dl; \
+ movb XREGS_cs(%esp),% ## _reg ## l; \
+ testb $3,% ## _reg ## l; \
je 1f; \
movl %ds,XREGS_ds(%esp); \
movl %es,XREGS_es(%esp); \
movl %fs,XREGS_fs(%esp); \
movl %gs,XREGS_gs(%esp);
-#define SAVE_ALL_NOSEGREGS \
- __SAVE_ALL_PRE \
+#define SAVE_ALL_NOSEGREGS(_reg) \
+ __SAVE_ALL_PRE(_reg) \
1:
-#define SET_XEN_SEGMENTS \
- movl $(__HYPERVISOR_DS),%edx; \
- movl %edx,%ds; \
- movl %edx,%es;
+#define SET_XEN_SEGMENTS(_reg) \
+ movl $(__HYPERVISOR_DS),%e ## _reg ## x; \
+ movl %e ## _reg ## x,%ds; \
+ movl %e ## _reg ## x,%es;
-#define SAVE_ALL \
- __SAVE_ALL_PRE \
- SET_XEN_SEGMENTS \
+#define SAVE_ALL(_reg) \
+ __SAVE_ALL_PRE(_reg) \
+ SET_XEN_SEGMENTS(_reg) \
1:
#endif